package com.whz.enuminterface;

import java.util.Arrays;
import java.util.Collection;

/**
 * @Author: sinosoft
 * @Description:
 * @Date: Create in 15:22 2021/5/17
 * @Modified By:
 */
public class OperationMainTest {
    public static void main(String[] args) {
        double x = 100d;
        double y = 2d;
//        test2(Arrays.asList(ExtendedOperation.values()), x, y);

    }
    private static <T extends Enum<T> & Operation> void test1(
            Class<T> opEnumType, double x, double y) {
        for (Operation op : opEnumType.getEnumConstants()) {
            System.out.printf("%f %s %f = %f%n", x, op, y, op.apply(x, y));
        }

    }

    private static void test2(Collection<? extends Operation> opSet,
                              double x, double y) {
        for (Operation op : opSet) {
            System.out.printf("%f %s %f = %f%n", x, op, y, op.apply(x, y));
        }

    }
}
